import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
//导入全局样式
import './assets/css/global.css'
//导入字体图标
import './assets/fonts/iconfont.css'

// 引入axios
import axios from 'axios'
// 引入ZkTable
import ZkTable from 'vue-table-with-tree-grid'
// 导入nprogress
import NProgress from 'nprogress'

axios.defaults.baseURL = 'http://server.sineava.top/api/private/v1/'
// 在request拦截器中显示进度条 NProgress.start()
axios.interceptors.request.use(config => {
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
// 在response拦截器中隐藏进度条 NProgress.done()
axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})
Vue.prototype.$http = axios

Vue.component('tree-table', ZkTable)


new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
